#include <mpi.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <algorithm>

#define LEN_HOSTNAME 32
#define MAX_NUM_NODE 32

int main(int argc, char** argv){
    int rank, nproc;
    int TAG = 100;
    MPI_Request send_request, recv_request;
    MPI_Status send_status, recv_status;
    MPI_Init(&argc,&argv);
    MPI_Comm_size(MPI_COMM_WORLD, &nproc);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    char hostname[LEN_HOSTNAME] = {0};
    char all_hostname[LEN_HOSTNAME*MAX_NUM_NODE] = {0};
    int node_flag[MAX_NUM_NODE] = {0};
    int group_split[MAX_NUM_NODE*2] = {0};
    MPI_Group node_groups[MAX_NUM_NODE];
    MPI_Comm node_comms[MAX_NUM_NODE];
    int head_group_incl[MAX_NUM_NODE];
    MPI_Group head_group;
    MPI_Comm head_comm;
    int node_cnt = 0;
    gethostname(hostname, sizeof(hostname));
    printf("Proc#%d:\thostname=%s\n",rank,hostname);
    MPI_Finalize();
    return 0;
}